﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Runtime.Serialization;

namespace ScrumTime.Models
{
    public class UserInfo 
    {
        ScrumTime.Models.User _user;
        System.Web.Security.MembershipUser _menbershipUser;

        public UserInfo(ScrumTime.Models.User user , System.Web.Security.MembershipUser menbershipUser   ) {
            _user = user;
            _menbershipUser = menbershipUser;
        }

        
        public String Mail {
            get {
                return _menbershipUser.Email;
            }            
        }

        public String UserName
        {
            get
            {
                return _menbershipUser.UserName;
            }
        }

        public int RolId {
            get{
                int resultado = -1;
                if ( this._user.Roles.Count > 0 ){
                    resultado = this._user.Roles.ElementAt(0).RolId;
                }            
                return resultado;
            }
        }

        public String UserKey {
            get {
                return this._menbershipUser.ProviderUserKey.ToString();
            }
        }
    }
}